Skip to content

Conversation

teunbrand
Copy link
Collaborator

This PR aims to fix #4993.

In brief, it creates caches for geom/stat defaults that are populated the first time a default is changed with update_{geom/stat}_defaults(). Then it uses that cache to reset the original defaults when new = NULL. In addition, the functions invisibly return the previous defaults.

I could not find an appropriate unit test for update_stat_defaults(). The examples also don't include update_stat_defaults() and I'm having a hard time imagining a use case for that function.

@teunbrand
Copy link
Collaborator Author

I realised that the test-function-args.r test accidentally picked up on the cache as a function to test arguments for. Renaming the cache appears to resolve that problem.

@teunbrand
Copy link
Collaborator Author

This is just a note that #5146 conflicts with this PR and either should update according to which one gets merged first.

teunbrand and others added 3 commits January 19, 2023 21:58
Merge branch 'main' of https://github.com/tidyverse/ggplot2 into tidyverse-main

# Conflicts:
#	R/geom-defaults.r
#	man/update_defaults.Rd
#	tests/testthat/test-geom-.R
teunbrand added 4 commits May 8, 2023 20:48
Merge branch 'main' into geom_defaults

# Conflicts:
#	man/update_defaults.Rd
@teunbrand teunbrand added the feature a feature request or enhancement label Jul 9, 2023
@teunbrand
Copy link
Collaborator Author

Closing this in favour of #5781.

@teunbrand teunbrand closed this Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reset original defaults with update_geom_defaults()
2 participants